package com.yunxin.admin.system.infra.persistence.repository;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunxin.admin.system.domain.model.log.Log;
import com.yunxin.admin.system.domain.model.log.LogRepository;
import com.yunxin.admin.system.infra.persistence.converter.LogConverter;
import com.yunxin.admin.system.infra.persistence.entity.SysLogDO;
import com.yunxin.admin.system.infra.persistence.mapper.SysLogMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

/**
 * @author zero°
 * @since 2023-07-11
 */
@Repository
@RequiredArgsConstructor
public class LogRepositoryImpl extends ServiceImpl<SysLogMapper, SysLogDO> implements LogRepository, IService<SysLogDO> {

    private final LogConverter logConverter;

    @Override
    public boolean saveLog(Log log) {
        SysLogDO sysLogDO = logConverter.fromLog(log);
        return this.save(sysLogDO);
    }
}
